<!DOCTYPE html>
<html>
<head>
    <title>备件清单</title>
    #parse("sys/header.html")
    <style>
        .target {
            position: absolute;
            /*font-size: 15px;*/
            bottom: 0;
            left: 0;
            background-color: rgba(0, 0, 0, 0.4);
            color: white;
            padding: 10px;
            opacity: 0;
            visibility: hidden;
            z-index: 50;
        }


        .sugon_upload_btn {
            display: -webkit-inline-box;
            display: inline-block;
        }
        .form-group {
            margin-bottom: 0px;
        }
        .ui-jqgrid tr.jqgrow td {
            white-space: normal !important; height:auto;
        }
        ::-webkit-scrollbar{
            width: 10px;
            height: 10px;
        }
        ::-webkit-scrollbar-thumb{
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <!-- 备件审核弹窗 -->
    <div id="apply" style="display: none;">
        <i-form ref="formValidate" :model="sparePartOut" :rules="ruleValidate" :label-width="80">
            <div class="form-group">
                <div class="form-group">
                    <Row>
                        <i-col span="22">
                            <Form-item label="审核列表">
                                {{approveSparePartList.join('、')}}
                            </Form-item>
                        </i-col>
                    </Row>
                    <Row v-if="rejectRemarkList.length > 0">
                        <i-col span="22">
                            <Form-item label="注意事项">
                                <Tooltip>
                                    <div slot="content" style="white-space: normal">
                                        请确保核对注意事项提及的问题处理完毕后再进行审核！
                                    </div>
                                    <Row v-for="rejectRemark in rejectRemarkList">
                                        {{rejectRemark}} <Icon type="md-information-circle" size="15" color="red"/>
                                    </Row>
                                </Tooltip>
                            </Form-item>
                        </i-col>
                    </Row>
                    <Row>
                        <i-col span="22">
                            <Form-item label="审核状态">
                                <i-select v-model="approveParam.status" placeholder="审核状态">
                                    <i-option value="1">通过</i-option>
                                    <i-option value="2">未通过</i-option>
                                </i-select>
                            </Form-item>
                        </i-col>
                    </Row>
                    <Row>
                        <i-col span="22">
                            <Form-item label="备注信息">
                                <i-input type="textarea" v-model="approveParam.remark" rows="3" placeholder="备注信息"></i-input>
                            </Form-item>
                        </i-col>
                    </Row>
                </div>
            </div>
        </i-form>
    </div>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group" v-show="!isFromApprove" >
                <i-col span="3">
                    <i-input v-model="q.partName" @on-enter="query" placeholder="备件名称"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.spec" @on-enter="query" placeholder="备件规格"></i-input>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.partCode" @on-enter="query" placeholder="备件编码"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.erpCode" @on-enter="query" placeholder="ERP编码"></i-input>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.producor" @on-enter="query" placeholder="生产厂家"></i-input>
                </i-col>
                <i-col span="2">
                    <i-select v-model="q.status" placeholder="审核状态">
                        <i-option value="">请选择</i-option>
                        <i-option v-for="status in statusList" :value="status.value" :key="status.value">{{status.name}}</i-option>
                    </i-select>
                </i-col>
                <i-col span="2">
                    <i-input v-model="q.createUserName" @on-enter="query" placeholder="录入人"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.remark" @on-enter="query" placeholder="备注"></i-input>
                </i-col>
                <i-col span="3">
                    <i-button type="info" @click="query">查询</i-button>
                    <i-button type="info" @click="reloadSearch">重置</i-button>
                </i-col>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("sparepart:save"))
                <i-button type="info" @click="addEqu"><i class="fa fa-bars"></i>&nbsp;备件档案</i-button>
                #end
                #if($shiro.hasPermission("sparepart:apply"))
                <i-button type="warning" @click="apply"><i class="fa fa-calendar-check-o"></i>&nbsp;审核</i-button>
                #end
                <!--#if($shiro.hasPermission("sparepart:goSparePartOut"))
                <i-button type="success" @click="goSparePartOut"><i class="fa fa-hand-o-down"></i>&nbsp;备件出库</i-button>
                #end-->
                #if($shiro.hasPermission("sparepart:import"))
                <Upload ref="uploadFile"
                        action="../sparepart/import"
                        :format="['xlsx','xls']"
                        :before-upload="handleBeforeUploadExcel"
                        :on-success="handleImportExcelSuccess" :on-error="handleImportExcelError"
                        :on-format-error="handleExcelFormatError" class="sugon_upload_btn">
                    <i-button type="error"><i class="fa fa-hand-o-down"></i>&nbsp;导入</i-button>
                </Upload>
                #end
                #if($shiro.hasPermission("sparepart:export"))
                <i-button type="success" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出</i-button>
                #end
                #if($shiro.hasPermission("sparepart:save"))
                <i-button type="info" @click="add" v-show="!isFromApprove"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("sparepart:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("sparepart:delete"))
                <i-button type="error" @click="del" v-show="!isFromApprove"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
    </div>
    <div id="target" class="target">

        <p>1、规格型号中不允许出现空格，所有字符在英文状态下输入；</p>
        <p>2、规格型号内包括多个参数的，各参数间用“/”分隔；</p>
        <p>3、特殊字母及符号从已列出的符号中进行选取；</p>
        <p>4、对制造商无特殊要求的，如标准件类，制造商选择“任意厂家”；</p>
        <p>5、易错符号：</p>
        <p>&nbsp;&nbsp;1） 乘号应用数学符号“×”；</p>
        <p>&nbsp;&nbsp;2） 直径应用软键盘中希腊字母的大写“Φ”；</p>
        <p>&nbsp;&nbsp;3） 括号应在半角状态下输入“()”；</p>
        <p>&nbsp;&nbsp;4） 单位符号表示长度及厚度的“mm”小写。</p>
    </div>
    <Card    v-show="!showList">
        <div  slot="title">{{title}}&nbsp;<button style="border-style: none;" @click="toggleVisibility"><i class="fa fa-question-circle"></i></button></div>
        <i-form ref="formValidate" :model="sparePart" :rules="ruleValidate" :label-width="100">
            <Row>
                <i-col span="24">
                    <Form-item  style="margin-bottom: 0px;">
                        <div  style="font-size: 18px;" slot="label">特殊字符</div>
                       <span style="font-size: 18px;"> {{spareSC}}</span>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="8">
                    <Form-item label="名称" prop="name">
                        <i-input v-model="sparePart.name" placeholder="标准规范的名称术语，不能写俗称" ref="editTask"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="规格" prop="spec">
                        <i-input v-model="sparePart.spec" placeholder="规格"></i-input>
                    </Form-item>
                    <span style="position: absolute; bottom: 7px; right: 0px;color: #8B91A0;">
                        特殊字符请从左上角复制
                    </span>
                </i-col>
                <i-col span="8">
                    <Form-item label="ERP编码" prop="erpCode">
                        <i-input v-model="sparePart.erpCode" placeholder="已有ERP编码的填写，新录入的不填"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="8">
                    <Form-item label="制造商" prop="producor">
                        <i-input v-model="sparePart.producor" placeholder="原始制造商" @on-click="loadFacType" readonly icon="md-arrow-dropdown-circle"></i-input>
                        <i-input v-model="sparePart.producerCode" v-show="false"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="价格" prop="price">
                        <i-input v-model="sparePart.price" placeholder="请输入数字,小数点后不超过两位"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="单位" prop="unit">
                        <i-select v-model="sparePart.unit" placeholder="单位">
                            <i-option v-for="partUnit in partUnitList" :value="partUnit" :key="partUnit">{{partUnit}}
                            </i-option>
                        </i-select>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="8">
                    <Form-item label="安全库存" prop="safeNum">
                        <input-number v-model="sparePart.safeNum" placeholder="安全库存" :min="0" @on-blur="getSafeNum(sparePart.safeNum)" style="width: 100%"></input-number>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="现场装机总量" prop="reserve1">
                        <i-input v-model="sparePart.reserve1" placeholder="现场装机总量" :disabled="!isEditable" @on-blur="getReserve1(sparePart.reserve1)" style="width: 100%"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="是否可替换" prop="isChange">
                        <Radio-group v-model="sparePart.isChange">
                            <Radio :label="1">
                                <span>是</span>
                            </Radio>
                            <Radio :label="0">
                                <span>否</span>
                            </Radio>
                        </Radio-group>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="8">
                    <Form-item label="设备类型" prop="devTypeName">
                        <i-input type="text" v-model="sparePart.devTypeName" icon="md-arrow-dropdown-circle" @on-click="devTypeShow" readonly="readonly" placeholder="设备类型"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="备件性质" prop="isChange">
                        <i-select v-model="sparePart.type" placeholder="备件性质">
                            <i-option value="">请选择</i-option>
                            <i-option v-for="source in typeList" :value="source.value" :key="source.value">{{source.name}}
                            </i-option>
                        </i-select>
                    </Form-item>
                </i-col>
                <i-col span="8">
                    <Form-item label="ABC类" prop="planAbc">
                        <i-select v-model="sparePart.planAbc" :disabled="!isEditable" placeholder="ABC分类" >
                            <i-option v-for="item in abcArray" :value="item.value" :key="item.value">{{item.name}}</i-option>
                        </i-select>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="8">
                    <Form-item label="备件类型"  prop="installPosition" >
                        <i-select v-model="sparePart.installPosition" placeholder="备件类型">
                            <i-option v-for="category in sparePartInstallPositionList" :value="category.id" :key="category.id">{{category.name}}</i-option>
                        </i-select>
                    </Form-item>
                </i-col>
                <i-col span="7">
                    <Form-item label="备件图片" prop="reserve2">
                        <i-input v-model="sparePart.reserve2" placeholder="铭牌或者备件正面照，图片尺寸小于5M" readonly @on-click="eyeFile(sparePart.reserve2)" icon="ios-eye"/>
                    </Form-item>
                    <span  style="position: absolute; bottom: 7px; right: -80px;color: #8B91A0;">
                        不上传图片将无法提出需求计划
                    </span>
                </i-col>
                <i-col span="1">
                    <Form-item :label-width="1">
                        <Upload ref="uploadFile" multiple style="width: 300px;" action="../sys/oss/sparepart/image"
                                :on-success="handleSuccess"
                                :before-upload="handleBeforeUpload"
                                :on-format-error="handleError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
<!--                                :max-size="5120">-->
                            <i-button icon="ios-cloud-upload-outline">上传</i-button>
                        </Upload>
                    </Form-item>

                </i-col>
                <i-col span="6">
                    <Form-item label="是否有效" prop="isValid">
                        <Radio-group v-model="sparePart.isValid">
                            <Radio :label="1">
                                <span>是</span>
                            </Radio>
                            <Radio :label="0">
                                <span>否</span>
                            </Radio>
                        </Radio-group>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="16">
                    <Form-item label="备注" prop="remark">
                        <i-input type="textarea" v-model="sparePart.remark" placeholder="备注"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">
                    返回
                </i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
    <!-- 审核列表区域 -->
    <div id="auditHistoryArea" style="display: none;">
        <i-table border :columns="auditTableColumns" :data="auditTableData"></i-table>
    </div>
</div>
<div id="categoryLayer" style="display: none;padding:10px;">
    <ul id="categoryTree" class="ztree"></ul>
</div>
<script src="${rc.contextPath}/js/spare/sparepart.js?_${date.systemTime}"></script>
</body>
</html>
